package software.agileCourse2013.KillerGame.biz.Command.CommandImpls;

import software.agileCourse2013.KillerGame.biz.Command.TemplateCommand;
import software.agileCourse2013.KillerGame.biz.Command.JsonParameter;
import software.agileCourse2013.KillerGame.biz.Command.JsonResult;
import software.agileCourse2013.KillerGame.biz.Command.JsonParameterImpls.testJsonPara;
import software.agileCourse2013.KillerGame.biz.Command.JsonResultImpls.testJsonResult;
import software.agileCourse2013.KillerGame.service.models.UserModel;

public class testCommand extends TemplateCommand{

	@Override
	public JsonParameter analysisParas(String JsonString) {
		testJsonPara res = new testJsonPara();
		return res.analysisParas(JsonString);
	}

	@Override
	protected JsonResult run(JsonParameter paras,UserModel user) {
		testJsonResult res = new testJsonResult();
		testJsonPara para = (testJsonPara) paras;
		res.setId(user.getId());
		res.setName(user.getName());
		res.setMsg(para.getId()+para.getName());
		return res;
	}

	@Override
	public String toJson(JsonResult jsonRes) {
		return jsonRes.toJson(jsonRes);
	}

}
